package org.netty.framework.core.concurrent;

/**
 * http server的业务线程池
 * 
 * @author chenfanglin
 * @date 2018年9月26日下午2:40:04
 */
public class HttpServerThreadPoolExecutor extends AbstractNettyThreadPool {

	private NettyServerThreadPoolExecutor nettyServerThreadPoolExecutor;

	private HttpServerThreadPoolExecutor() {
	}

	private static class HttpServerThreadPoolExecutorHolder {
		private static final HttpServerThreadPoolExecutor HTTP_SERVER_THREADPOOL_EXECUTOR = new HttpServerThreadPoolExecutor();
	}

	public static HttpServerThreadPoolExecutor getInstance() {
		return HttpServerThreadPoolExecutorHolder.HTTP_SERVER_THREADPOOL_EXECUTOR;
	}

	@Override
	public void createThreadPoolExecutor() {
		this.nettyServerThreadPoolExecutor = super.createThreadPoolExecutor("http-server");
	}

	@Override
	public NettyServerThreadPoolExecutor getThreadPoolExecutor() {
		if (this.nettyServerThreadPoolExecutor == null) {
			createThreadPoolExecutor();
		}
		return this.nettyServerThreadPoolExecutor;
	}

}
